package com.moleq.models;

import com.moleq.db.DatabaseSchema;


public class Group {
//	CREATE TABLE t_dept_group
//	(dg_no integer NOT NULL,
//	dg_name varchar(30) NOT NULL,
//	create_datetime varchar(14) NULL,
//	update_datetime varchar(14) NULL,
//	PRIMARY KEY (dg_no));
	
	private int dg_no;
	private String dg_name;
	private String create_datetime; 
	private String update_datetime; 

	public Group(){}
	public Group(int dg_no,String dg_name,String create_datetime,String update_datetime){
		this.dg_no = dg_no;
		this.dg_name = dg_name;
		this.create_datetime = create_datetime;
		this.update_datetime = update_datetime;
	}
	
	public Group(int dg_no,String dg_name){
		this.dg_no = dg_no;
		this.dg_name = dg_name;
	}
	
	
	public int getDg_no() {
		return dg_no;
	}
	public void setDg_no(int dg_no) {
		this.dg_no = dg_no;
	}
	public String getDg_name() {
		return dg_name;
	}
	public void setDg_name(String dg_name) {
		this.dg_name = dg_name;
	}
	public String getCreate_datetime() {
		return create_datetime;
	}
	public void setCreate_datetime(String create_datetime) {
		this.create_datetime = create_datetime;
	}
	public String getUpdate_datetime() {
		return update_datetime;
	}
	public void setUpdate_datetime(String update_datetime) {
		this.update_datetime = update_datetime;
	}
	
	public String toMGData(String Action){
		
		String Result = Action + "|" + DatabaseSchema.DeptGroup.SCHEMA_NAME + "|(" + getDg_no() + "," + CheckNull(getDg_name())
				+ "," + CheckNull(getCreate_datetime()) + ","
				+ CheckNull(getUpdate_datetime()) + ")";
		return Result;
	}
	
	public String CheckNull(String value) {
		if (value == null) {
			return null;
		} else {
			return "'" + value + "'";
		}
	}
}
